﻿using System;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using HYView;

namespace YArchitech.MEP.Electric.CableLay
{
	[Regeneration(RegenerationOption.Manual)]
	[Transaction(TransactionMode.Manual)]
	public class CmdCableTrayDim2 : IExternalCommand
	{
		public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
		{
			UIDocument activeUIDocument = commandData.Application.ActiveUIDocument;
			if (!(activeUIDocument.Document.ActiveView is ViewPlan))
			{
				Result result = SwitchView.SetUsableView((CmdViewType)3, commandData);
                if (result != Result.Succeeded)
				{
					return result;
				}
			}
			new CableTrayDim(activeUIDocument).DoDim();
			return Autodesk.Revit.UI.Result.Succeeded;
		}
	}
}
